package com.ruoyi.web.controller.bank;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TAppDetails;
import com.ruoyi.system.service.ITAppDetailsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 对账明细Controller
 * 
 * @author ruoyi
 * @date 2025-04-23
 */
@RestController
@RequestMapping("/system/details")
public class TAppDetailsController extends BaseController
{
    @Autowired
    private ITAppDetailsService tAppDetailsService;

    /**
     * 查询对账明细列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TAppDetails tAppDetails)
    {
        startPage();
        List<TAppDetails> list = tAppDetailsService.selectTAppDetailsList(tAppDetails);
        return getDataTable(list);
    }

    /**
     * 导出对账明细列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, TAppDetails tAppDetails)
    {
        List<TAppDetails> list = tAppDetailsService.selectTAppDetailsList(tAppDetails);
        ExcelUtil<TAppDetails> util = new ExcelUtil<TAppDetails>(TAppDetails.class);
        util.exportExcel(response, list, "对账明细数据");
    }

    /**
     * 获取对账明细详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tAppDetailsService.selectTAppDetailsById(id));
    }

    /**
     * 新增对账明细
     */
    @PostMapping
    public AjaxResult add(@RequestBody TAppDetails tAppDetails)
    {
        return toAjax(tAppDetailsService.insertTAppDetails(tAppDetails));
    }

    /**
     * 修改对账明细
     */
    @PutMapping
    public AjaxResult edit(@RequestBody TAppDetails tAppDetails)
    {
        return toAjax(tAppDetailsService.updateTAppDetails(tAppDetails));
    }

    /**
     * 删除对账明细
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tAppDetailsService.deleteTAppDetailsByIds(ids));
    }
}
